package com.ctshk.task.worker.processors;

import com.ctshk.rpc.guide.service.IGuideCollarService;
import com.github.kfcfans.powerjob.worker.core.processor.ProcessResult;
import com.github.kfcfans.powerjob.worker.core.processor.TaskContext;
import com.github.kfcfans.powerjob.worker.core.processor.sdk.BasicProcessor;
import com.github.kfcfans.powerjob.worker.log.OmsLogger;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Component;

/**
 * 定时修改  导领信息
 * 每月吊起一次
 *
 * @author 谢诗宏
 * @since 2021-1-20
 */
@Component
public class GuideCollarProcessorMonth implements BasicProcessor {


    @DubboReference
    private IGuideCollarService guideCollarService;

    @Override
    public ProcessResult process(TaskContext context) {
        //月初计算所有在职员工的假期，安排礼拜天休假，如有任务就增加月假
        OmsLogger omsLogger = context.getOmsLogger();
        guideCollarService.vacationStatistics();
        omsLogger.info("导领中心[{}]", "success");
        boolean success = !"failed".equals(context.getJobParams());
        omsLogger.info("IGuideCollarService finished process,success: .", success);
        return new ProcessResult(success, context + ": success");
    }
}
